#pragma once
#ifndef __GLF_DEBUGGER_SLEEPY_H__
#define __GLF_DEBUGGER_SLEEPY_H__

#include <glf/config.h>

#if GLF_ENABLE_DEBUGGER

#if defined(WIN32)
#include <windows.h>
#endif
#include <glf/debugger/debugger.h>
#include <vector>
#include <glf/debugger/packet.h>

namespace glf
{
	namespace debugger
	{
		enum E_DEBUGGER_MESSAGE_TYPE
		{
			// Debugger to Glitch	
			EDMT_REQUEST_TEXTURES,
			EDMT_REQUEST_HIERARCHY,
			EDMT_REQUEST_NODE_PROPERTIES,
			EDMT_SET_DEBUGGER_OPTIONS,
			EDMT_SET_BREAKPOINTS,
			EDMT_CONTINUE,
			EDMT_SUSPEND,
			EDMT_STEP,
			EDMT_REQUEST_RESFILES,
			EDMT_REQUEST_STRINGS,
			EDMT_REQUEST_BUFFERS,
			EDMT_REQUEST_BREAKPOINTS,
			EDMT_REQUEST_TEXTURE_MIPMAP,
			EDMT_REQUEST_MATERIAL_RENDERERS,
			EDMT_REQUEST_MATERIAL_RENDERER,
			EDMT_REQUEST_SHADERS,
			EDMT_REQUEST_SHADER,
			EDMT_SET_CONDITIONAL_BREAKPOINTS,
			EDMT_SUBSTITUTE_TEXTURE,
			EDMT_SET_RENDER_OPTIONS,
			EDMT_REQUEST_NAMED_SCOPES,
			EDMT_REQUEST_GPU_ANALYSIS,
			EDMT_REQUEST_REFERENCES,
			EDMT_SET_CAMERA_TRANSFORM,
			EDMT_REQUEST_SCREENSHOT,
			EDMT_UPDATE_SHADER,
			EDMT_UPDATE_TEXTURE,
			EDMT_COMPILE_SHADER,
			EDMT_REQUEST_ANIMATION_GRAPH_TRACE,

			// Glitch to Debugger
			EDMT_TEXTURE_LIST,
			EDMT_TEXTURE,
			EDMT_HIERARCHY,
			EDMT_NODE_PROPERTIES,
			EDMT_BREAKPOINT_HIT,
			EDMT_CLEAR_STATE_LIST,
			EDMT_MESH,
			EDMT_COLOR_BUFFER,
			EDMT_DEPTH_BUFFER,
			EDMT_STENCIL_BUFFER,
			EDMT_DRIVER_STATE,
			EDMT_MATERIAL_RENDERER_STATE,
			EDMT_MATERIAL_INSTANCE_STATE,
			EDMT_RESFILES,
			EDMT_STRINGS,
			EDMT_BUFFERS,
			EDMT_LIGHTS_STATE,
			EDMT_STATES,
			EDMT_BREAKPOINTS,
			EDMT_TEXTURE_MIPMAP_REGION,
			EDMT_MATERIAL_RENDERERS,
			EDMT_MATERIAL_RENDERER,
			EDMT_SHADERS,
			EDMT_SHADER,
			EDMT_NAMED_SCOPES,
			EDMT_GPU_ANALYSIS,
			EDMT_REFERENCES,
			EDMT_SCREENSHOT,
			EDMT_SHADER_COMPILE_LOG,
			EDMT_ANIMATION_GRAPH_TRACE_FRAME,
			EDMT_REQUEST_SLEEPY_PID,
			EDMT_SLEEPY_PID
		};

		class Sleepy : public Module
		{
			GLF_DECLARE_SINGLETON_WITH_DEP(Sleepy, Debugger)
		public:
			virtual ~Sleepy();
			virtual void UpdateFrame();
			virtual void Parse(int type, PacketReader& in);
			//virtual void ConnectionClosed();

			void sendSleepyPID();

		private:
			Sleepy();

			bool initDone;

			PacketWriter mPacketWriter;

			PacketWriter & GetPacketWriter()
			{
				return this->mPacketWriter;
			}
		};
	}
}

#endif // GLF_ENABLE_DEBUGGER
#endif // __GLF_DEBUGGER_SLEEPY_H__
